1. Field of the Invention
The present invention relates to a phase difference detection device which can be employed on an imaging apparatus such as a camera or a video camera, an imaging apparatus including the phase difference detection device, a phase difference detection method, and a computer-readable recording medium containing computer program code for causing a computer to carry out the phase difference detection method.
2. Description of the Related Art
In conventional imaging apparatuses, the focus state of an image-taking lens is detected in an autofocus (AF) operation. For example, a focus detection method is known that is for detecting a focus state of an image-taking lens from a phase difference between a pair of image signals between which the relative position relationship changes depending on the focus state of the image-taking lens. A method for detecting a phase difference between a pair of image signals on the basis of a predefined amount of information (hereinafter referred to as “amount of correlation”) obtained from a pair of image signals is disclosed in Japanese Patent Laid-Open No. 62-39722. Two output signals are created that show the phase correlation of the two image signals. In Japanese Patent Laid-Open No. 62-39722, a pair of radiant energy detectors are positioned to receive energy in the form of image signals from a scene being viewed. A first of such detectors produces a first output signal pattern while a second of such detectors produces a second output signal pattern. The two patterns coincide at the desired focus position but move with respect to one another in a first or opposite direction depending upon the focus condition. The slope of one or both of the patterns at predetermined positions is multiplied by the difference in value from the outputs of the detectors to create values which are summed. The sign of the summed values is representative of the direction the taking lens must be moved to bring the patterns into coincidence at the desired focus position. The sum of the first resulting signal and the second resulting signal is defined as an amount of correlation. A phase difference between a pair of image signals is detected on the basis of the amount of correlation. In addition, a TTL (“through the lens”) phase difference focus detection device for detecting a focus state of an image-taking lens from a phase difference between a pair of image signals produced by a light beam transmitted through different pupil areas of the taking lens is disclosed in Japanese Patent Laid-Open No. 63-264715. In Japanese Patent Laid-Open No. 63-264715, the sum of the absolute values of the phase difference between a pair of image signals is defined as an amount of correlation. A phase difference between a pair of image signals is detected on the basis of the amount of correlation. Furthermore, the phase difference focus detection method of the external measuring type is disclosed in Japanese Patent Laid-Open No. 2004-12601.
However, there are the following problems with the conventional phase difference detection methods. At a position away from the center of the optical axis of an image-taking lens, an uneven decrease in light intensity from a pair of image signals occurs due to vignetting of an image-taking lens, resulting in a gain difference between two image signals. An attempt to detect a phase difference between two image signals having a gain difference may result in not only detection difficulty caused by a poor degree of coincidence therebetween but may also result in detection error depending on the pattern of an image signal. FIG. 35A is a view showing the waveforms of two image signals when there is a gain difference. The y-axis shows a pixel output against the pixel position in the x-axis (as in FIGS. 13A, 14A and 15A as will be described later). The pixel output is the output from an image sensor represented by a wave-pattern. FIG. 35A illustrates a case where an object having a gradation pattern with black on the left, white on the right, and a gradual change from black to white at the boundary between the black and the white is captured. FIG. 35A also shows the state where there is no phase difference between two image signals. Assume that the phase difference detection is performed by an amount of correlation disclosed in Japanese Patent Laid-Open No. 62-39722 and Japanese Patent Laid-Open No. 63-264715 when two image signals as shown in FIG. 35A are obtained. In this case, the gain difference that has occurred between two image signals cannot be distinguished from the phase difference between two image signals. Consequently, the phase difference detection mistakenly determines that two image signals are matched at a lateral offset position.
FIG. 35B is a view showing the waveforms of two image signals when a conventional phase difference detection has mistakenly determined that two image signals were matched when there was a gain difference. In the prior art, the area denoted by hatching in FIG. 35B corresponds to an amount of correlation, so that it is determined that two image signals are matched in the state shown in FIG. 35B at which the hatched area is minimized. Hence, when the phase difference detection is performed using a conventional amount of correlation, the phase difference detection mistakenly determines that two image signals are matched at a lateral offset position due to the influence of a level difference as shown in FIG. 35B. As a result, the problem arises in that deviations in the phase difference detection result of two image signals will occur. For example, a method for correcting a gain difference by determining the amount of an uneven decrease in light intensity is also contemplated. However, there exist the vignetting deviation due to manufacturing error on an image-taking lens, the vignetting deviation due to play of an image-taking lens during zoom/focus driving, and the aperture ratio deviation due to manufacturing fluctuations on a lens system that forms a pair of optical images, or the like. Therefore, an error caused by these various factors still remains in gain correction, which may result in the gain difference as shown in FIG. 35A. When such correction remains present, the problem also arises in that deviations in the phase difference detection result of two image signals will occur.